import axios from 'axios'
import { FILMTYPE_ADDFILMS } from '@/store/types/filmType'

// 网络请求  --  按需导出

// const createActionFilms = data => ({ type: 'addFilms', data })
const createActionFilms = data => ({ type: FILMTYPE_ADDFILMS, data })
// 电影列表数据网络获取
export const getFilmListAction = () => async dispatch => {
  let ret = await axios.get('/mock/films.json')
  // 发布给redux来更新它的数据源
  // dispatch({ type: 'addFilms', data: ret.data })
  dispatch(createActionFilms(ret.data))
}
